In some cases, it is useful to intercept record deletions in your generated application.
For example, suppose you do not want certain selected records to be deleted when your user clicks the "Delete" button?
One way to accomplish this is to override the DeleteButton_Click() button handler method.
For example, we can check Order records' postal code when the user select the records, and clicks the "Delete" button.
If a record contains the postal code as "11111", then the deletion of that record is cancelled, an error message is displayed, and remaining records are deleted;
otherwise, all the selected records are deleted.
This example code customization checks for a field's value. If the field's value matches some value like "11111" then, deletion of the record
is cancelled. It also provides an error message, and if there is any other selected records, their deletion process will continue.
For a Web Application the customization will be added in:
..\<Application Name>\<Table Name>\Show<Table Name>Table.Controls.cs
For example: C:\MyApp1\Orders\ShowOrdersTable.controls.cs
For a Web Site the customization will be added in:
..\<Application Name>\App_Code\<Table Name>\Show<Table Name>Table.Controls.cs
For example: C:\MyApp1\App_Code\Orders\ShowOrdersTable.controls.cs
|